package com.assignwork.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Data
public class GroupDayStatPlanVO {

    private String dsplanId;
    private String svoyageId;
    private String shipName;
    private String portDistrict;
    private String teamOrgnId;
    /**
     * Y 计划,  T 暂停
     */
    private String statType;
    private String statTypeName;
    @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
    @JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
    private Date statTime;
    private String statCode;
    private String statName;
    private String berthCode;
    private String berthName;
    private String planBerthCode;
    private String planBerthName;
    private String draft;
    private String tugNum;
    private String pilotFlag;
    private String pilotFlagName;
    private String begCable;
    private String endCable;
    private String cableDistance;
    private String description;
    /**
     * N:新增, B:变更, T:退
     */
    private String alterType;
    private String alterTypeName;
    /**
     * '0'为申请， ‘1’为变更
     */
    private String askFlag;
    private String askFlagName;
    private String moveOrgnId;
    private String statCodeStr;
    private String kbsj;
    private String shipLength;
    private String shipWidth;
    private String sdw;
    // 进口航次
    private String impVoyage;
    // 出口航次
    private String expVoyage;

    public String getStatTypeName() {
        if (Func.isNotBlank(statType)) {
            return "Y".equals(statType) ? "计划" : "暂停";
        }
        return statTypeName;
    }

    public String getAlterTypeName() {
        if (Func.isNotBlank(alterType)) {
            return "N".equals(alterType) ? "新增" : "B".equals(alterType) ? "变更" : "退";
        }
        return alterTypeName;
    }

    public String getAskFlagName() {
        if (Func.isNotBlank(askFlag)) {
            return "0".equals(askFlag) ? "申请" : "变更";
        }
        return askFlagName;
    }

    public String getPilotFlagName() {
        if (Func.isNotBlank(pilotFlag)) {
            return "1".equals(pilotFlag) ? "是" : "否";
        }
        return pilotFlagName;
    }
};
